<template>
    <div class="demo">
        测试
    </div>
</template>
<script>
export default {
    data() {
      return {};
    },
    created(){
     this.test();
    },
    methods: {
        test() {
            var arr2 = ['a','b','c','d','e','g','f'] 
            console.log('删除之前的长度', arr2.length);
            arr2.map((item,index) => {
                console.log(index,item === 'g');
              if(item === 'g'){
                arr2.splice(index,1);
              }
            });
            console.log('删除之后的长度 ',arr2.length);
        }
    }
}
</script>

